<template>
  <page-header-wrapper>
    <a-row :gutter="24" class="head">
      <a-col :lg="6" :sm="12" :xs="24">
        <a-card class="card">
          <div class="title">
            <span>总销售额</span>
            <a-icon type="info-circle" />
          </div>
          <div class="money">￥12560</div>
          <div class="foot">
            <div class="count">
              <span>当日销售额</span>
              <span>￥2423</span>
            </div>
          </div>
        </a-card>
      </a-col>
      <a-col :lg="6" :sm="12" :xs="24">
        <a-card class="card">
          <div class="title">
            <span>商品收入</span>
            <a-icon type="info-circle" />
          </div>
          <div class="money">￥6560</div>
          <div class="foot">
            <div class="count">
              <span>今日商品收入</span>
              <span>￥2423</span>
            </div>
          </div>
        </a-card>
      </a-col>
      <a-col :lg="6" :sm="12" :xs="24">
        <a-card class="card">
          <div class="title">
            <span>售出订单</span>
            <a-icon type="info-circle" />
          </div>
          <div class="money">60</div>
          <div class="foot">
            <div class="count">
              <span>今日售出</span>
              <span>23</span>
            </div>
          </div>
        </a-card>
      </a-col>
      <a-col :lg="6" :sm="12" :xs="24">
        <a-card class="card">
          <div class="title">
            <span>累计收入</span>
            <a-icon type="info-circle" />
          </div>
          <div class="money">￥1256</div>
          <div class="foot">
            <div class="count">
              <span>可提现</span>
              <span>￥2423</span>
            </div>
            <span class="withdrow" @click="showWithdrowBox">立即提现</span>
          </div>
        </a-card>
      </a-col>
    </a-row>
    <div class="tableBox">
      <div class="title">
        <span>提现记录</span>
        <a-range-picker @change="onChange">
          <a-icon slot="suffixIcon" type="calendar" />
        </a-range-picker>
      </div>
      <div class="content">
        <a-table :columns="columns" :data-source="recordsList" @change="changePage"> </a-table>
      </div>
    </div>
    <!-- 提现弹窗 -->
    <a-modal v-model="showWithdrow" title="提现申请" @ok="confirmWithdrow">
      <a-form-model :model="withdrowForm" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
        <a-form-model-item label="转账方式">
          <a-radio-group v-model="withdrowForm.method">
            <a-radio :value="1"> 微信线下转账 </a-radio>
            <a-radio :value="2"> 支付宝转账 </a-radio>
            <a-radio :value="3"> 银行卡转账 </a-radio>
          </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="微信号" v-if="withdrowForm.method == 1">
          <a-input v-model="withdrowForm.wx" placeholder="请输入微信号" />
        </a-form-model-item>
        <a-form-model-item label="微信昵称" v-if="withdrowForm.method == 1">
          <a-input v-model="withdrowForm.wxNickname" placeholder="请输入备注昵称" />
        </a-form-model-item>
        <a-form-model-item label="支付宝账号" v-if="withdrowForm.method == 2">
          <a-input v-model="withdrowForm.wxNickname" placeholder="请输入支付宝账号" />
        </a-form-model-item>
        <a-form-model-item label="支付宝真实姓名" v-if="withdrowForm.method == 2">
          <a-input v-model="withdrowForm.wxNickname" placeholder="请输入支付宝真实姓名" />
          <span class="tip">*请填写真实姓名，否则将不予转账</span>
        </a-form-model-item>
        <a-form-model-item label="银行卡账号" v-if="withdrowForm.method == 3">
          <a-input v-model="withdrowForm.wx" placeholder="请输入银行卡账号" />
        </a-form-model-item>
        <a-form-model-item label="开户行" v-if="withdrowForm.method == 3">
          <a-input v-model="withdrowForm.wx" placeholder="请输入开户行" />
        </a-form-model-item>
        <a-form-model-item label="开户人" v-if="withdrowForm.method == 3">
          <a-input v-model="withdrowForm.wx" placeholder="请输入开户人" />
        </a-form-model-item>
        <a-form-model-item label="提现金额">
          <a-input v-model="withdrowForm.money" placeholder="请输入提现金额" />
        </a-form-model-item>
      </a-form-model>
    </a-modal>
  </page-header-wrapper>
</template>

<script>
const columns = [
  {
    title: '转账方式',
    dataIndex: 'name',
    key: 'name',
    scopedSlots: { customRender: 'method' },
  },
  {
    title: '提现金额',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
  },
  {
    title: '申请时间',
    dataIndex: 'time',
    key: 'time',
  },
]
export default {
  data() {
    return {
      columns: columns,
      // 提现记录
      recordsList: [],
      // 是否显示提现弹窗
      showWithdrow: false,
      // 提现表单
      withdrowForm: {
        // 转账方式
        method: 1,
        // 微信号
        wx: '',
        // 微信昵称
        wxNickname: '',
        // 提现金额
        money: '',
      },
    }
  },
  methods: {
    onChange(e) {
      console.log(e)
    },
    changePage(e) {
      console.log(e)
    },
    // 点击确认提现
    confirmWithdrow() {},
    // 点击立即提现
    showWithdrowBox() {
      this.showWithdrow = true
    },
  },
}
</script>

<style lang="less" scoped>
.head {
  .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.45);
    .anticon {
      font-size: 12px;
      cursor: pointer;
    }
  }
  .money {
    padding: 8px 0 20px 0;
    border-bottom: 1px solid #e8e8e8;
    font-size: 30px;
    font-family: HelveticaNeue;
    color: rgba(0, 0, 0, 0.85);
  }
  .foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    font-size: 14px;
    font-family: PingFangSC-Regular;
    .count {
      display: flex;
      align-items: center;
      span:nth-child(1) {
        color: rgba(0, 0, 0, 0.65);
      }
      span:nth-child(2) {
        color: rgba(0, 0, 0, 0.85);
        margin-left: 8px;
      }
    }
    .withdrow {
      color: #33abfb;
      cursor: pointer;
    }
  }
}
.tableBox {
  margin-top: 24px;
  background-color: #fff;
  .title {
    display: flex;
    align-items: center;
    height: 50px;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 32px;
    justify-content: space-between;
    span {
      font-size: 16px;
      color: #000;
      font-weight: 600;
    }
  }
  .content {
    margin-top: 22px;
    padding: 0 32px;
  }
}
.tip {
  font-size: 14px;
  color: #ff4400;
}
</style>